{	Problem: http://codeforces.ru/problemset/problem/34/C
	Verdict: Accepted
}
uses sysutils;
var i,l,r,m,k,cur:longint; s:string; a:array[1..1010] of boolean;
begin
readln(S);
fillchar(a,sizeof(a),false);
m:=0;
while length(s)>0 do begin
  cur:=pos(',',s);
  if cur<>0 then begin
    k:=strtoint(copy(s,1,cur-1));
    delete(s,1,cur);
    a[k]:=true;
    if k>m then m:=k;
  end else begin
    k:=strtoint(s);
    if k>m then m:=k;
    a[k]:=true;
    s:='';
  end;
end;
l:=0;
r:=0;
for i:=1 to m do begin
  if a[i] then begin
    if l=0 then begin
      l:=i;
      r:=i;
    end else r:=i;
  end else begin
    if l<>0 then begin
      if r-l>0 then s:=s+inttostr(l)+'-'+inttostr(r)+',' else s:=s+inttostr(l)+',';
      l:=0;
      r:=0;
    end;
  end;
end;
if l<>0 then
  if r-l>0 then s:=s+inttostr(l)+'-'+inttostr(r)+',' else s:=s+inttostr(l)+',';
if s[length(S)]=',' then delete(s,length(s),1);
write(s);
end.